package com.touchfired.common.core.publisher.impl;

import com.touchfired.common.core.callback.Callback;
import com.touchfired.common.core.event.BaseEvent;
import com.touchfired.common.core.publisher.BasePublisher;
import org.springframework.stereotype.Component;

/**
 * 事件发布器
 * @author 幸佳俊
 */
@Component
public class EventPublisher extends BasePublisher {

    @Override
    public Object publish(BaseEvent event) {
        final Object[] obj = {null};
        publishEvent(event, new Callback() {
            @Override
            public <T> void call(T t) {
                obj[0] = t;
            }
        });
        return obj[0];
    }

}
